package com.hsgene.shoppingcar.exception;

import com.hsgene.common.util.exception.ErrorCode;

/**
 * @description:
 * @projectName: hdas-geneshop-server
 * @package: com.hsgene.shoppingcar.exception
 * @author: maodi
 * @createDate: 2018/10/15 11:32
 * @version: 1.0
 * Copyright: Copyright (c) 2018
 */
public enum GeneticTestingOrderCarErrorCode implements ErrorCode {

    GET_GENETIC_TESTING_ORDER_CAR_IS_ERROR(80100, "GET_GENETIC_TESTING_ORDER_CAR_IS_ERROR", "获取小程序购物车列表数据出错"),
    INSERT_GENETIC_TESTING_ORDER_CAR_IS_ERROR(80101, "INSERT_GENETIC_TESTING_ORDER_CAR_IS_ERROR", "新增小程序购物车数据出错"),
    DELETE_GENETIC_TESTING_ORDER_CAR_IS_ERROR(80102, "DELETE_GENETIC_TESTING_ORDER_CAR_IS_ERROR", "删除小程序购物车数据出错"),
    UPDATE_GENETIC_TESTING_ORDER_CAR_CHECKED_IS_ERROR(80103, "UPDATE_GENETIC_TESTING_ORDER_CAR_CHECKED_IS_ERROR",
            "修改小程序购物车勾选状态出错"),
    PACKAGE_ID_IS_NULL(80104, "PACKAGE_ID_IS_NULL", "商品id为空"),
    AMOUNT_ID_IS_EQUAL_1(80105, "AMOUNT_ID_IS_EQUAL_ONE", "购物车数量不为1"),
    CHECKED_ID_IS_NULL(80106, "CHECKED_ID_IS_NULL", "购物车勾选为空"),
    DELETE_TYPE_ID_IS_NULL(80107, "DELETE_TYPE_ID_IS_NULL", "购物车删除类型为空"),
    GENETIC_TESTING_ORDER_CAR_IS_EXIST(80108, "GENETIC_TESTING_ORDER_CAR_IS_EXIST", "购物车已存在当前商品请下订单后再添加"),
    GENETIC_TESTING_ORDER_CAR_ID_IS_NULL(80109, "GENETIC_TESTING_ORDER_CAR_ID_IS_NULL", "购物车信息id为空"),
    GENETIC_TESTING_ORDER_CAR_DELETE_FLAG_IS_NULL(80110, "GENETIC_TESTING_ORDER_CAR_DELETE_FLAG_IS_NULL",
            "购物车信息是否删除为空"),
    GENETIC_TESTING_ORDER_CAR_DELETE_TYPE_IS_NULL(80111, "GENETIC_TESTING_ORDER_CAR_DELETE_TYPE_IS_NULL",
            "购物车信息删除类型为空"),
    GENETIC_TESTING_ORDER_CAR_CHECKED_IS_NULL(80112, "GENETIC_TESTING_ORDER_CAR_CHECKED_IS_NULL",
            "购物车信息是否勾选为空"),
    GENETIC_TESTING_ORDER_CAR_CHECKED_IS_ERROR(80113, "GENETIC_TESTING_ORDER_CAR_CHECKED_IS_ERROR",
            "购物车信息是否勾选应为0或1"),
    GENETIC_TESTING_ORDER_CAR_DELETE_FLAG_IS_ERROR(80114, "GENETIC_TESTING_ORDER_CAR_DELETE_FLAG_IS_ERROR",
            "购物车信息删除标识应为0或1"),
    GENETIC_TESTING_ORDER_CAR_DELETE_TYPE_IS_ERROR(80115, "GENETIC_TESTING_ORDER_CAR_DELETE_TYPE_IS_ERROR",
            "购物车信息删除类型应为0或1"),
    HAVE_BEEN_DELETED(80116, "HAVE_BEEN_DELETED", "该条购物车商品已经被删除"),
    USER_TYPE_IS_NULL(80117, "USER_TYPE_IS_NULL", "用户类型为空"),
    USER_TYPE_IS_ERROR(80118, "USER_TYPE_IS_ERROR", "用户类型有误"),
    CHECKED_ID_IS_ERROR(80119, "CHECKED_ID_IS_ERROR", "购物车勾选值只能为0或1"),
    IS_SHOPPING_CAR_ID_IS_ERROR(80120, "IS_SHOPPING_CAR_ID_IS_ERROR", "是否从购物车购买只能为0或1"),
    SHOPPING_CAR_HAS_DOWN_SHELF_STATUS(80121, "SHOPPING_CAR_HAS_DOWN_SHELF_STATUS", "购物车中商品不能包含已经下架的");

    private final int code;

    private final String message;

    private final String description;

    GeneticTestingOrderCarErrorCode(int code, String message, String description) {
        this.code = code;
        this.message = message;
        this.description = description;
    }

    public static GeneticTestingOrderCarErrorCode getEnum(int code) {
        for (GeneticTestingOrderCarErrorCode errorCode : values()) {
            if (errorCode.code == code) {
                return errorCode;
            }
        }
        throw new IllegalArgumentException("No element matches " + code);
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public String getDescription() {
        return description;
    }

}
